/*
什么叫mixin
*/

/*
对象的mixin
Object.assign({a:1},{b:2});

函数的mixin
Object.defineProperty(Fn.prototype,'a',1);
*/

//类的mixin↓
const mixin1 = (superClass) => {
  return class extends superClass {
    beforeCreate(){
      super.beforeCreate();
      console.log('mixin1')
    }
  };
};

const mixin = (superClass) => {
  return class extends superClass {
    beforeCreate(){
      super.beforeCreate();
      console.log('mixin')
    }
  };
};

class Parent {
  beforeCreate(){
    console.log('父亲执行')
  }
}

class Child extends mixin1(mixin(Parent)){
  beforeCreate(){
    super.beforeCreate();
    console.log('儿子执行');
  }
}

let child = new Child();
child.beforeCreate();

//在儿子和父亲之间再加一个beforeCreate
